package module16;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.events.EventFiringWebDriver;

public class Listener_Test {

	/**
	 * @param args
	 */
	public static WebDriver Web_driver ;
	public static void main(String[] args) throws Throwable {
		Web_driver = new FirefoxDriver();
		
		EventFiringWebDriver driver = new  EventFiringWebDriver(Web_driver );
		MyListener mylistener = new MyListener();
		driver.register(mylistener);
		
		driver.navigate().to("http://www.gmail.com");
		
		driver.findElement(By.xpath("html/body/div[1]/div[2]/div[2]/ul[1]/li[3]/p[2]/a")).click();
		
		Thread.sleep(4000);
		System.out.println("Going to click back button");
		driver.navigate().back();
		System.out.println("clicked back button");
		Thread.sleep(4000);
		
		driver.navigate().forward();
		Thread.sleep(4000);
		
		driver.quit();


	}

}
